package com.gx.recruitment.service.impl;

import com.gx.recruitment.entity.User_info;
import com.gx.recruitment.entity.User_infoExample;
import com.gx.recruitment.mapper.User_infoMapper;
import com.gx.recruitment.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private User_infoMapper user_infoMapper;

    @Override
    public int insertUser(User_info record) {
        user_infoMapper.insert(record);
        return 0;
    }

    @Override
    public List<User_info> findbyUserName(String username) {
        User_infoExample example = new User_infoExample();
        User_infoExample.Criteria cri = example.createCriteria();
        cri.andUserNameEqualTo(username);
        return user_infoMapper.selectByExample(example);
    }


    @Override
    public List<User_info> loginUser(String username , String userpass) {
        User_infoExample example = new User_infoExample();
        User_infoExample.Criteria cri = example.createCriteria();
        cri.andUserNameEqualTo(username);
        cri.andUserPassEqualTo(userpass);
        return user_infoMapper.selectByExample(example);
    }
}
